<template>
<div class="shopbuy-list">
    <div class="shop-item" @click="goDetail(0)">
        <img src="https://img11.360buyimg.com/cms/jfs/t21205/273/1226856135/33181/1b5f028b/5b2217afNc64021be.jpg!q95.jpg" alt="">
        <h2 class="title">华为荣耀10</h2>
        <div class="info">
            <p class="price">
                <span class="now">￥888</span>
                <span class="old">￥999</span>
            </p>
            <p class="sell">
                <span>热卖中</span>
                <span>剩60件</span>
            </p>
        </div>
    </div>
    <div class="shop-item" @click="goDetail(1)">
        <img src="https://img11.360buyimg.com/cms/jfs/t21205/273/1226856135/33181/1b5f028b/5b2217afNc64021be.jpg!q95.jpg" alt="">
        <h2 class="title">华为荣耀10</h2>
        <div class="info">
            <p class="price">
                <span class="now">￥888</span>
                <span class="old">￥999</span>
            </p>
            <p class="sell">
                <span>热卖中</span>
                <span>剩60件</span>
            </p>
        </div>
    </div>
    <div class="shop-item" @click="goDetail(2)">
        <img src="https://img11.360buyimg.com/cms/jfs/t21205/273/1226856135/33181/1b5f028b/5b2217afNc64021be.jpg!q95.jpg" alt="">
        <h2 class="title">华为荣耀10</h2>
        <div class="info">
            <p class="price">
                <span class="now">￥888</span>
                <span class="old">￥999</span>
            </p>
            <p class="sell">
                <span>热卖中</span>
                <span>剩60件</span>
            </p>
        </div>
    </div>
    <div class="shop-item" @click="goDetail(3)">
        <img src="https://img11.360buyimg.com/cms/jfs/t21205/273/1226856135/33181/1b5f028b/5b2217afNc64021be.jpg!q95.jpg" alt="">
        <h2 class="title">华为荣耀10</h2>
        <div class="info">
            <p class="price">
                <span class="now">￥888</span>
                <span class="old">￥999</span>
            </p>
            <p class="sell">
                <span>热卖中</span>
                <span>剩60件</span>
            </p>
        </div>
    </div>
</div>
</template>

<script>
export default {
    data(){
        //data往自己组件内部，挂载数据
        return{}
    },
    methods:{
        goDetail(id){//使用js进行路由导航
        this.$router.push('shopinfo/'+id)
        }
    } 
}
</script>

<style lang="less" scoped>
    .shopbuy-list{
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        padding: 6px;
        .shop-item{
            width: 49%;
            border: 1px solid #ccc;
            margin: 3px 0;
            img{
                width: 100%;
            }
            h2{
                font-size: 14px;
            }
            .info{
                background-color: #eee;
                p{
                    margin: 0;
                    padding: 5px;
                }
                .price{
                    .now{
                        color: red;
                        font-weight: bold;
                        font-size: 16px;
                    }
                    .old{
                        text-decoration: line-through;
                        font-size: 12px;
                        margin-left: 10px;
                    }
                }
                .sell{
                    display: flex;
                    justify-content: space-between;
                    font-size: 13px;
                }
            }
        }
    }
</style>